export default {
	formatMessage: function(data, message) {
		return {
			code: '000000',
			message: message,
			data: data
		}
	},
	formatErrorMessage: function(data, message) {
		return {
			code: '111111',
			message: message,
			data: data
		}
	},
	formatErrorMessageCode: function(code, data, message) {
		return {
			code: code,
			message: message,
			data: data
		}
	},
	formatPaging: function(list, page, size, total) {
		return {	
			dataGrid: list,
			page: page,
			pageSize: size,
			pageCount: total/size,
			itemCount: total,
		}
	},
	param2Obj: function(url) {
		const search = url.split('?')[1]
		if (!search) {
			return {}
		}
		return JSON.parse(
			'{"' +
			decodeURIComponent(search)
			.replace(/"/g, '\\"')
			.replace(/&/g, '","')
			.replace(/=/g, '":"') +
			'"}'
		)
	}
}
